package com.imdroid.lite.activities;

import android.app.Activity;
import android.app.ProgressDialog;

import com.imdroid.lite.IMDroid;

public class ProgressDialogHelper {
	/**
	 * The progress dialog
	 */
	private static ProgressDialog progressDialog;

	/**
	 * show the progress
	 * 
	 * @param act
	 *            the activity
	 * @param title
	 *            the title string
	 * @param message
	 *            the message string
	 */
	public static void showProgress(Activity act, String title, String message) {
		if (progressDialog != null) {
			dismissProgress();
		}
		progressDialog = ProgressDialog.show(act, title, message);
		progressDialog.setCancelable(true);
	}

	/**
	 * show the progress
	 * 
	 * @param act
	 *            the activity
	 * @param title
	 *            the title string
	 * @param message
	 *            the message string
	 */
	public static void showProgress(Activity act, int title, int message) {
		showProgress(act, IMDroid.getAppContext().getString(title), IMDroid
				.getAppContext().getString(message));
	}

	/**
	 * dismiss the progress
	 */
	public static void dismissProgress() {
		if (progressDialog != null) {
			progressDialog.dismiss();
		}
		progressDialog = null;
	}
}
